/*
 * This file is part of the Sx Framework Library.
 * 
 * Copyright (C) 2013 University of Colorado Denver
 * <min.choi@ucdenver.edu> <shane.transue@ucdenver.edu>
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy 
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
 * copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in 
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 */
#ifndef SX_PROGESS_MONITORABLE_H
#define SX_PROGESS_MONITORABLE_H

#include <sxProgessMonitor.h>

namespace Sx {
namespace Task {

/*
 * All tasks that take a considerable amount of time should extend this class
 * so that the progress monitoring facilities provided by this class can be 
 * used to inform the user about the current state of the task. When a task
 * class extends the ProgressMonitorable abstract class they have access to
 * the internal progressMonitor interface. This provides all classes that extend
 * the ProgressMonitorable abstract class with a ProgressMonitor object that
 * can be used to update a Progressable implementation to show the progress
 * state of the task.
 *
 * This class is a psudeo interface class where every class that extends this
 * class has the ability to update a Progressable implementation to inform the
 * user about the progress of a defined task. For example, to show the user
 * that a task is processing 100 elements the following code outline could be
 * used:
 *
 *  class MyTask : public ProgressMonitorable {
 *  ...
 *    void longOperation() {
 *      progressMonitor.setRange(1, 100);
 *      progressMonitor.setText("Processing 100 elements...");
 *      for i = 1 to 100
 *          processCurrentElement...
 *			progressMonitor.setValue(i);
 *    }
 *  }
 */
class ProgressMonitorable {
public:
	ProgressMonitorable();
	virtual ~ProgressMonitorable();

	void setMonitor(Progressable* progressMonitor);

protected:
	/*
	 * The ProgressMonitor is provided as an object so that when clients use
	 * the ProgressMonitorable base class they do not need to check to see if
	 * the provided Progressable point is null for every operation.
	 */
	ProgessMonitor progressMonitor;
};

}

}

#endif
